/****************************************************
          File Name:17-3.cpp
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Mon Jan 19 17:47:31 2015
*****************************************************/

#include<iostream>
#include<fstream>
#include<cstdlib>
using namespace std;

int main(int argc, char *argv[])
{
    if(argc < 3)
    {
        cerr << argv[0] << "src dst" << endl;
        exit(EXIT_FAILURE);
    }

    char ch;

    ifstream fin_src;
    ofstream fout_dst;

    fout_dst.open(argv[2], ios_base::out | ios_base::app);
    try
    {
        fin_src.open(argv[1]);
    }
    catch(ios_base::failure & bad)
    {
        cout << bad.what() << endl;
    }

    while(fin_src.get(ch))
    {
        fout_dst << ch;
    }

    fin_src.close();
    fout_dst.close();
    return 0;
}
